package day5;



public class Car extends Vehicle {
    private String type;
    public Car(){

    }
    public Car(String vehicleid, String brand, int rent, int seats, String state, String type) {
        super(vehicleid, brand, rent, seats, state);
        this.type = type;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
    public void show() {
        System.out.println("轿车"+"\t"+getBrand()+"  "+getType()+"\t"+"车牌号为"+getVehicleid()
                +"\t"+"日租金为"+getRent()+"元"+"\t"+super.getState());

    }

    //在子类中计算租金
    public double calcRent(int days) {
        double price = this.getRent() * days;
        if (days > 7 && days <= 30) {
            price *= 0.9;
        } else if (days > 30 && days <= 150) {
            price *= 0.8;
        } else if (days > 150) {
            price *= 0.7;
        }
        return price;
    }
}
